|
|
|
|
|
|
|
The RayDisk class manages disk objects. This class is very similar to the RayPlane class. It uses the first point defining the plane as the center of the disk. It also has a Radius variable that gives the disk's radius. |
|
|
|
|
|
|
|
|
RayDisk's FindT function first determines whether a ray intersects the plane that contains the disk. It does this exactly as the RayPlane object does. If the ray intersects the plane, FindT determines whether the point of intersection lies within the radius of the disk. If it does not, the point is on the plane but not the disk, so the intersection is not useful. |
|
|
|
 |
|
|
|
|
' Return the value T for the point of intersection
' between the vector from point (px, py, pz) in
' the direction <vx, vy, vz>.
'
' direct_calculation is true if we are finding the
' intersection from a viewing position ray. It is
' false if we are finding a reflected intersection
' or a shadow feeler. Public Function RayTraceable_FindT( _
ByVal direct_calculation As Boolean, _
ByVal px As Single, ByVal py As Single, _
ByVal pz As Single, ByVal Vx As Single, _
ByVal Vy As Single, ByVal Vz As Single) As Single
Dim A As Single
Dim B As Single
Dim C As Single
Dim D As Single
Dim Nx As Single
Dim Ny As Single
Dim Nz As Single
Dim denom As Single
Dim t As Single
Dim Cx As Single
Dim Cy As Single
Dim Cz As Single
Dim dx As Single
Dim dy As Single
Dim dz As Single
Dim X As Single
Dim Y As Single
Dim Z As Single
' See if we have been culled. If direct_calculation And DoneOnThisScanline Then
RayTraceable_FindT = -1
Exit Function
End If
' Find the unit normal at this point. GetUnitNormal Nx, Ny, Nz
' Compute the plane's parameters. |
|
|
|
|
|